package JD.Q3;

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String input = scanner.nextLine();

        String result = findNextString(input);
        System.out.println(result);
    }

    private static String findNextString(String s) {
        char[] chars = s.toCharArray();
        int length = chars.length;

        // 从字符串末尾向前遍历
        for (int i = length - 1; i >= 0; i--) {
            if (chars[i] != 'z') {
                chars[i] = (char) (chars[i] + 1); // 当前字符加1
                for (int j = i + 1; j < length; j++) {
                    chars[j] = 'a'; // 将当前字符后面的所有字符变为'a'
                }
                return new String(chars);
            }
        }

        // 如果字符串全为'z'，返回-1
        return "-1";
    }
}
